fix: create missing output directories for GPX and event exports (#26)#28
Conversation
- Add std::fs::create_dir_all() to export_to_gpx before file creation - Add std::fs::create_dir_all() to export_to_event before file creation - Both functions now match export_to_csv behavior for directory handling - Fixes issue where exports to non-existent directories would fail with ENOENT Resolves: #26
📝 WalkthroughWalkthroughReplaced manual path construction in GPX and Event exports with Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related issues
Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (4)src/**/*.rs📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/{parser/**/*.rs,export.rs}📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/{export.rs,lib.rs}📄 CodeRabbit inference engine (AGENTS.md)
Files:
{src/**/*.rs,Cargo.toml}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (6)📓 Common learnings📚 Learning: 2025-12-13T15:51:00.125ZApplied to files:
📚 Learning: 2025-12-13T15:51:00.125ZApplied to files:
📚 Learning: 2025-12-13T15:51:00.125ZApplied to files:
📚 Learning: 2025-12-13T15:51:00.125ZApplied to files:
📚 Learning: 2025-12-13T15:51:00.125ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/export.rs (1)
386-391: Optional: Consider usingcompute_export_pathsto reduce duplication.Both
export_to_gpxandexport_to_eventduplicate the filename construction logic (suffix and extension patterns) that's already implemented incompute_export_paths(). As noted in the PR objectives, this is a lower-priority refactor that could reduce duplication and ensure naming consistency.Also applies to: 456-461
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/export.rs(2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.rs: Do not remove or modify comments unless the related code is changed
Only add comments that explain code functionality; no AI instructional comments
Never embed or call external binaries from Rust code
Ensurecargo build --releasehas no errors or warnings
Only commit ifcargo clippy --all-targets --all-features -- -D warningspasses
Only commit ifcargo fmt --all -- --checkpasses
Only commit ifcargo test --verbosepasses
Only commit ifcargo build --releasepasses with no errors or warnings
BEFORE ANY CODE CHANGES: Always runcargo clippy --all-targets --all-features -- -D warningsto catch ALL issues
BEFORE ANY CODE CHANGES: Always runcargo fmt --all -- --checkto ensure formatting compliance
Ifcargo fmt --all -- --checkfails, IMMEDIATELY runcargo fmt --allto fix formatting
Code must passcargo fmt --all -- --checkwithout any formatting issues
Never skip clippy checks or formatting checks. Never allow warnings to pass
ALWAYS runcargo fmt --allafter making ANY code changes before moving to next steps
After runningcargo fmt --all, ALWAYS verify withcargo fmt --all -- --checkbefore proceeding
Files:
src/export.rs
src/{parser/**/*.rs,export.rs}
📄 CodeRabbit inference engine (AGENTS.md)
Parser modules should be placed in
src/parser/and export functions insrc/export.rsfor sharing between library and CLI
Files:
src/export.rs
src/{export.rs,lib.rs}
📄 CodeRabbit inference engine (AGENTS.md)
The CSV output must precisely match the format and header order of blackbox_decode CSV files
Files:
src/export.rs
{src/**/*.rs,Cargo.toml}
📄 CodeRabbit inference engine (AGENTS.md)
{src/**/*.rs,Cargo.toml}: Only commit ifcargo test --features=cli --verbosepasses
All feature combinations must compile without errors
Files:
src/export.rs
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: nerdCopter/bbl_parser PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-13T15:51:00.125Z
Learning: Applies to src/main.rs : CLI (`src/main.rs`) should use library export functions (`export_to_csv`, `export_to_gpx`, `export_to_event`) with CLI-specific status messages
Learnt from: CR
Repo: nerdCopter/bbl_parser PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-13T15:51:00.125Z
Learning: Applies to src/lib.rs : Public API must expose: `parse_bbl_file()`, `parse_bbl_bytes()`, `BBLLog`, `ExportOptions`, `export_to_csv()`, `export_to_gpx()`, `export_to_event()`, conversion utilities, parser helpers
Learnt from: CR
Repo: nerdCopter/bbl_parser PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-13T15:51:00.125Z
Learning: Applies to src/{parser/**/*.rs,export.rs} : Parser modules should be placed in `src/parser/` and export functions in `src/export.rs` for sharing between library and CLI
Learnt from: CR
Repo: nerdCopter/bbl_parser PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-13T15:51:00.125Z
Learning: Applies to src/{export.rs,lib.rs} : The CSV output must precisely match the format and header order of blackbox_decode CSV files
Learnt from: nerdCopter
Repo: nerdCopter/bbl_parser PR: 2
File: LICENSE_COMMERCIAL:1-4
Timestamp: 2025-08-29T19:52:05.099Z
Learning: nerdCopter prefers to avoid publishing personal information in license files for privacy and security reasons, as they are an individual maintainer rather than a company.
Learnt from: nerdCopter
Repo: nerdCopter/bbl_parser PR: 2
File: README.md:520-521
Timestamp: 2025-08-29T19:53:41.354Z
Learning: nerdCopter uses AGPL-3.0-or-later licensing for the bbl_parser project with a dual-licensing approach that includes a separate commercial license option.
Learnt from: nerdCopter
Repo: nerdCopter/bbl_parser PR: 2
File: CONTRIBUTING.md:9-14
Timestamp: 2025-08-21T20:25:45.741Z
Learning: nerdCopter prefers to keep CLA language general using "project maintainer" rather than specifying a legal entity name, as they are an individual maintainer without an associated company.
Learnt from: nerdCopter
Repo: nerdCopter/bbl_parser PR: 2
File: LICENSE_COMMERCIAL:0-0
Timestamp: 2025-08-29T20:15:04.624Z
Learning: nerdCopter prefers clear positive indicators (✅) when describing fixes rather than using ❌ symbols which can be confusing when describing what was corrected in a positive context.
📚 Learning: 2025-12-13T15:51:00.125Z
Learnt from: CR
Repo: nerdCopter/bbl_parser PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-13T15:51:00.125Z
Learning: Applies to src/main.rs : CLI (`src/main.rs`) should use library export functions (`export_to_csv`, `export_to_gpx`, `export_to_event`) with CLI-specific status messages
Applied to files:
src/export.rs
📚 Learning: 2025-12-13T15:51:00.125Z
Learnt from: CR
Repo: nerdCopter/bbl_parser PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-13T15:51:00.125Z
Learning: Applies to src/lib.rs : Public API must expose: `parse_bbl_file()`, `parse_bbl_bytes()`, `BBLLog`, `ExportOptions`, `export_to_csv()`, `export_to_gpx()`, `export_to_event()`, conversion utilities, parser helpers
Applied to files:
src/export.rs
📚 Learning: 2025-12-13T15:51:00.125Z
Learnt from: CR
Repo: nerdCopter/bbl_parser PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-13T15:51:00.125Z
Learning: Applies to src/{parser/**/*.rs,export.rs} : Parser modules should be placed in `src/parser/` and export functions in `src/export.rs` for sharing between library and CLI
Applied to files:
src/export.rs
📚 Learning: 2025-12-13T15:51:00.125Z
Learnt from: CR
Repo: nerdCopter/bbl_parser PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-13T15:51:00.125Z
Learning: Applies to src/{export.rs,lib.rs} : The CSV output must precisely match the format and header order of blackbox_decode CSV files
Applied to files:
src/export.rs
📚 Learning: 2025-12-13T15:51:00.125Z
Learnt from: CR
Repo: nerdCopter/bbl_parser PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-13T15:51:00.125Z
Learning: Applies to src/{main,lib}.rs : Core logic in `src/lib.rs` and CLI entry point in `src/main.rs`
Applied to files:
src/export.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test (windows-latest)
🔇 Additional comments (2)
src/export.rs (2)
380-384: Directory creation fix looks good.The added logic correctly ensures the output directory exists before writing the GPX file, matching the
export_to_csvbehavior and resolving issue #26.
450-454: Directory creation fix looks good.The added logic correctly ensures the output directory exists before writing the event file, matching the
export_to_csvbehavior and resolving issue #26.
…aming - Replace duplicate filename construction logic in export_to_gpx and export_to_event - Both functions now use compute_export_paths() for consistent naming with CSV exports - Reduces code duplication and improves maintainability - Ensures naming scheme stays in sync across all export formats Related to: #26
Fixes issue #26: The GPX and event export functions failed when
export_options.output_dirpointed to a non-existent directory. This PR mirrors the behavior ofexport_to_csv()by addingstd::fs::create_dir_all()toexport_to_gpx()andexport_to_event()before attempting to create files.Changes
Bug fix:
export_to_gpx()andexport_to_event()Refactor (reduces duplication):
compute_export_paths()for consistent naming with CSV exports.NNsuffix and extensions)Testing
Resolves: #26
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.